#ifndef SEARCHRESULTLIST_H
#define SEARCHRESULTLIST_H

#include <QListWidget>
#include <QWidget>
#include "adduseritem.h"
#include "global.h"
#include "loadingdlg.h"
#include "userdata.h"
#include <memory>
class SearchResultList : public QListWidget
{
    Q_OBJECT
public:
    SearchResultList(QWidget *parent = nullptr);
    void setSearchEdit(QWidget *edit);
    // QObject interface
public:
    virtual bool eventFilter(QObject *watched, QEvent *event) override;
public slots:
    void slot_RedPointVisible(bool visible = true);

private:
    bool _sendSpending;
    QWidget *_searchEdit;
    LoadingDlg *_loadingDlg;
    std::shared_ptr<QDialog> _findDlg;
    AddUserItem *_addUserItem;

private:
    void waitPending(bool pending = true);
    void addTipItem();
private slots:
    void slot_itemClicked(QListWidgetItem *item);
    void slot_userSearch(std::shared_ptr<SearchInfo> si);

    // QWidget interface
protected:
    virtual void paintEvent(QPaintEvent *event) override;
};

#endif // SEARCHRESULTLIST_H
